package com.elminster.analyze.util;

import java.util.Arrays;
import java.util.List;

/**
 * 
 * @author Gu
 *
 */
public class AnalyzeUtil<E extends Comparable<E>> {
	
	/** Records what need be analyzed */
	private List<E> records;
	
	private boolean sorted = false;
	
	public AnalyzeUtil(E... records) {
		this.records = Arrays.asList(records);
	}
	
	public AnalyzeUtil(List<E> records) {
		this.records = records;
	}
	
	private boolean assertNotNull() {
		return null != records;
	}
	
	/**
	 * Quick sort
	 */
	public void sort() {
		if (!assertNotNull()) {
			throw new NullPointerException();
		}
		System.out.println(records.toString());
		System.out.println(records.toString());
	}
	
	public static void main(String[] args) {
		Integer[] i = new Integer[] {3, 9, 6, 1, 4, 5, 2};
		AnalyzeUtil<Integer> util = new AnalyzeUtil<Integer>(i);
		util.sort();
	}

	private void swap(List<E> records2, int i, int j) {
		E tmpRec = records2.get(i);
		records2.set(i, records2.get(j));
		records2.set(j, tmpRec);
	}
}
